package erfgame.core.world.terrain.insertion;

import java.awt.Point;
import java.awt.Rectangle;


public abstract class AbstractSurfaceInsertion implements SurfaceInsertion {
	
	private static final long serialVersionUID = 0;

//	public int getOrder(SurfaceInsertion renderer) {
//		Rectangle myBounds = this.getBounds();
//		Rectangle rBounds = renderer.getBounds();
//		Rectangle overlap = myBounds.intersection( rBounds );
//		int order;
//		if( overlap.width > 0 && overlap.height > 0 ) {
//			int myDepth = this.getDepth( overlap );
//			if( myDepth >= 0 ) {
//				int rDepth = renderer.getDepth( overlap );
//				if( rDepth >= 0 ) {
//					if( rDepth > myDepth ) {
//						order = ORDER_BEHIND;
//					} else if( rDepth < myDepth ) {
//						order = ORDER_IN_FRONT;
//					} else {
//						order = ORDER_DONT_CARE;
//					}
//				} else {
//					order = ORDER_DONT_CARE;
//				}
//			} else {
//				order = ORDER_DONT_CARE;
//			}
//		} else {
//			order = ORDER_DONT_CARE;
//		}
//		return order;
//	}
	
	public boolean contains(int lx, int ly) {
		return getBounds().contains(lx, ly);
	}

	public String toString() {
		Rectangle bounds = getBounds();
		Point center = new Point( bounds.x + bounds.width/2, bounds.y + bounds.height/2 );
		return getClass().getName()+"[depth="+getDepth( center )+"]";
	}
}
